Optimal. Leaf size=116 \[ \frac {1}{16} \left (8 a^2+4 a b+b^2\right ) x+\frac {\left (8 a^2+4 a b+b^2\right ) \cos (e+f x) \sin (e+f x)}{16 f}-\frac {b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.09, antiderivative size = 116, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.217, Rules used = {3270, 424, 393,
205, 209} \begin {gather*} \frac {\left (8 a^2+4 a b+b^2\right ) \sin (e+f x) \cos (e+f x)}{16 f}+\frac {1}{16} x \left (8 a^2+4 a b+b^2\right )-\frac {b (8 a+3 b) \sin (e+f x) \cos ^3(e+f x)}{24 f}-\frac {b \sin (e+f x) \cos ^5(e+f x) \left ((a+b) \tan ^2(e+f x)+a\right )}{6 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 205
Rule 209
Rule 393
Rule 424
Rule 3270
Rubi steps
\begin {align*} \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx &=\frac {\text {Subst}\left (\int \frac {\left (a+(a+b) x^2\right )^2}{\left (1+x^2\right )^4} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}+\frac {\text {Subst}\left (\int \frac {a (6 a+b)+3 (a+b) (2 a+b) x^2}{\left (1+x^2\right )^3} \, dx,x,\tan (e+f x)\right )}{6 f}\\ &=-\frac {b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}+\frac {\left (8 a^2+4 a b+b^2\right ) \text {Subst}\left (\int \frac {1}{\left (1+x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{8 f}\\ &=\frac {\left (8 a^2+4 a b+b^2\right ) \cos (e+f x) \sin (e+f x)}{16 f}-\frac {b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}+\frac {\left (8 a^2+4 a b+b^2\right ) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{16 f}\\ &=\frac {1}{16} \left (8 a^2+4 a b+b^2\right ) x+\frac {\left (8 a^2+4 a b+b^2\right ) \cos (e+f x) \sin (e+f x)}{16 f}-\frac {b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac {b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.20, size = 79, normalized size = 0.68 \begin {gather*} \frac {12 ((2-2 i) a+b) ((2+2 i) a+b) (e+f x)+3 (4 a-b) (4 a+b) \sin (2 (e+f x))-3 b (4 a+b) \sin (4 (e+f x))+b^2 \sin (6 (e+f x))}{192 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.35, size = 134, normalized size = 1.16
method | result | size |
risch | \(\frac {a^{2} x}{2}+\frac {a b x}{4}+\frac {b^{2} x}{16}+\frac {b^{2} \sin \left (6 f x +6 e \right )}{192 f}-\frac {\sin \left (4 f x +4 e \right ) a b}{16 f}-\frac {\sin \left (4 f x +4 e \right ) b^{2}}{64 f}+\frac {\sin \left (2 f x +2 e \right ) a^{2}}{4 f}-\frac {\sin \left (2 f x +2 e \right ) b^{2}}{64 f}\) | \(103\) |
derivativedivides | \(\frac {b^{2} \left (-\frac {\left (\sin ^{3}\left (f x +e \right )\right ) \left (\cos ^{3}\left (f x +e \right )\right )}{6}-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{8}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{16}+\frac {f x}{16}+\frac {e}{16}\right )+2 a b \left (-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{4}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{8}+\frac {f x}{8}+\frac {e}{8}\right )+a^{2} \left (\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}\) | \(134\) |
default | \(\frac {b^{2} \left (-\frac {\left (\sin ^{3}\left (f x +e \right )\right ) \left (\cos ^{3}\left (f x +e \right )\right )}{6}-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{8}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{16}+\frac {f x}{16}+\frac {e}{16}\right )+2 a b \left (-\frac {\left (\cos ^{3}\left (f x +e \right )\right ) \sin \left (f x +e \right )}{4}+\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{8}+\frac {f x}{8}+\frac {e}{8}\right )+a^{2} \left (\frac {\cos \left (f x +e \right ) \sin \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}\) | \(134\) |
norman | \(\frac {\left (\frac {1}{2} a^{2}+\frac {1}{4} a b +\frac {1}{16} b^{2}\right ) x +\left (3 a^{2}+\frac {3}{2} a b +\frac {3}{8} b^{2}\right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (3 a^{2}+\frac {3}{2} a b +\frac {3}{8} b^{2}\right ) x \left (\tan ^{10}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (10 a^{2}+5 a b +\frac {5}{4} b^{2}\right ) x \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (\frac {1}{2} a^{2}+\frac {1}{4} a b +\frac {1}{16} b^{2}\right ) x \left (\tan ^{12}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (\frac {15}{2} a^{2}+\frac {15}{4} a b +\frac {15}{16} b^{2}\right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (\frac {15}{2} a^{2}+\frac {15}{4} a b +\frac {15}{16} b^{2}\right ) x \left (\tan ^{8}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\frac {\left (8 a^{2}-4 a b -b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{8 f}-\frac {\left (8 a^{2}-4 a b -b^{2}\right ) \left (\tan ^{11}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{8 f}+\frac {\left (8 a^{2}+12 a b +19 b^{2}\right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}-\frac {\left (8 a^{2}+12 a b +19 b^{2}\right ) \left (\tan ^{7}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}+\frac {\left (72 a^{2}+60 a b -17 b^{2}\right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{24 f}-\frac {\left (72 a^{2}+60 a b -17 b^{2}\right ) \left (\tan ^{9}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{24 f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{6}}\) | \(387\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 134, normalized size = 1.16 \begin {gather*} \frac {3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} {\left (f x + e\right )} + \frac {3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{5} + 8 \, {\left (6 \, a^{2} - b^{2}\right )} \tan \left (f x + e\right )^{3} + 3 \, {\left (8 \, a^{2} - 4 \, a b - b^{2}\right )} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{6} + 3 \, \tan \left (f x + e\right )^{4} + 3 \, \tan \left (f x + e\right )^{2} + 1}}{48 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.40, size = 85, normalized size = 0.73 \begin {gather*} \frac {3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} f x + {\left (8 \, b^{2} \cos \left (f x + e\right )^{5} - 2 \, {\left (12 \, a b + 7 \, b^{2}\right )} \cos \left (f x + e\right )^{3} + 3 \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{48 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 314 vs.
\(2 (107) = 214\).
time = 0.44, size = 314, normalized size = 2.71 \begin {gather*} \begin {cases} \frac {a^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} x \cos ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} + \frac {a b x \sin ^{4}{\left (e + f x \right )}}{4} + \frac {a b x \sin ^{2}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{2} + \frac {a b x \cos ^{4}{\left (e + f x \right )}}{4} + \frac {a b \sin ^{3}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{4 f} - \frac {a b \sin {\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{4 f} + \frac {b^{2} x \sin ^{6}{\left (e + f x \right )}}{16} + \frac {3 b^{2} x \sin ^{4}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{16} + \frac {3 b^{2} x \sin ^{2}{\left (e + f x \right )} \cos ^{4}{\left (e + f x \right )}}{16} + \frac {b^{2} x \cos ^{6}{\left (e + f x \right )}}{16} + \frac {b^{2} \sin ^{5}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{16 f} - \frac {b^{2} \sin ^{3}{\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{6 f} - \frac {b^{2} \sin {\left (e + f x \right )} \cos ^{5}{\left (e + f x \right )}}{16 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin ^{2}{\left (e \right )}\right )^{2} \cos ^{2}{\left (e \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.46, size = 84, normalized size = 0.72 \begin {gather*} \frac {1}{16} \, {\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} x + \frac {b^{2} \sin \left (6 \, f x + 6 \, e\right )}{192 \, f} - \frac {{\left (4 \, a b + b^{2}\right )} \sin \left (4 \, f x + 4 \, e\right )}{64 \, f} + \frac {{\left (16 \, a^{2} - b^{2}\right )} \sin \left (2 \, f x + 2 \, e\right )}{64 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 14.73, size = 120, normalized size = 1.03 \begin {gather*} x\,\left (\frac {a^2}{2}+\frac {a\,b}{4}+\frac {b^2}{16}\right )+\frac {\left (\frac {a^2}{2}+\frac {a\,b}{4}+\frac {b^2}{16}\right )\,{\mathrm {tan}\left (e+f\,x\right )}^5+\left (a^2-\frac {b^2}{6}\right )\,{\mathrm {tan}\left (e+f\,x\right )}^3+\left (\frac {a^2}{2}-\frac {a\,b}{4}-\frac {b^2}{16}\right )\,\mathrm {tan}\left (e+f\,x\right )}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^6+3\,{\mathrm {tan}\left (e+f\,x\right )}^4+3\,{\mathrm {tan}\left (e+f\,x\right )}^2+1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________